package com.example.aqarapp.view.adapter;

import android.view.View;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.example.aqarapp.entity.DeviceListItem;

import org.jetbrains.annotations.Nullable;

import java.util.List;

import aqarapp.R;

public class DeviceListRecyclerAdapter extends BaseMultiItemQuickAdapter<DeviceListItem, BaseViewHolder> {

    private View bulb_view;
    private View curtain_view;
    private View socket_view;
    public static final int TYPE_ONE = 0;
    public static final int TYPE_TWO = 1;

    public DeviceListRecyclerAdapter(@Nullable List<DeviceListItem> data) {
        super(data);
        addItemType(TYPE_ONE, R.layout.test1);
        addItemType(TYPE_TWO, R.layout.test2);
    }

//    public DeviceListRecyclerAdapter(int layoutResId) {
//        super(layoutResId);
//        addChildClickViewIds(R.id.bulb_info_layout);
//        addChildClickViewIds(R.id.socket_info_layout);
//        addChildClickViewIds(R.id.curtain_info_layout);
//    }


//    @Override
//    protected void convert(@NotNull BaseViewHolder baseViewHolder, DeviceListItem deviceListItem) {
//        baseViewHolder.setText(R.id.device_list_info_place_tv, deviceListItem.location);
//        bulb_view = baseViewHolder.getView(R.id.bulb_info_layout);
//        curtain_view = baseViewHolder.getView(R.id.curtain_info_layout);
//        socket_view = baseViewHolder.getView(R.id.socket_info_layout);
//        initViewClickable();
//        int noDeviceColor = getContext().getResources().getColor(R.color.gray_D8D8D8);
//        if(deviceListItem.getBulbInfo()==null){
//            bulb_view.setClickable(false);
//            bulb_view.setBackgroundColor(noDeviceColor);
//        }
//        if(deviceListItem.getCurtainInfo()==null){
//            curtain_view.setClickable(false);
//            curtain_view.setBackgroundColor(noDeviceColor);
//        }
//        if(deviceListItem.getSocketInfo()==null){
//            socket_view.setClickable(false);
//            socket_view.setBackgroundColor(noDeviceColor);
//        }
//    }


    @Override
    protected void convert(@NonNull BaseViewHolder baseViewHolder, DeviceListItem deviceListItem) {
        switch (baseViewHolder.getItemViewType()) {
            case TYPE_ONE:


                break;
            case TYPE_TWO:

                break;
        }
    }

//
//    private void initViewClickable() {
//        bulb_view.setClickable(true);
//        curtain_view.setClickable(true);
//        socket_view.setClickable(true);
//    }
}
